﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Kooboo.Extensions;
using System.ComponentModel.Composition;
using Kooboo.Domain;

namespace Kooboo.Commerce.Repositories
{
    [Export(typeof(IEntityDeleteCommand<ITax>))]
    public class TaxDeleteCommand:EntityDeleteCommand<ITax>
    {
        protected override string TableName
        {
            get {
                return "Tax";
            }
        }
        protected override string BuildCondition()
        {
            var ids = this.EntitySet.Select(i => i.Id.ToString()).ToArray();

            if (ids.Length == 0)
            {
                return " 1=2 ";
            }
            else
            {
                return " Id in (" + ids.Join(",") + ") ";
            }
        }
    }
}
